<template>
  <div>
    <h2>{{ name }}--{{ age }}--{{ sex }}</h2>
  </div>
  <div>
    <button @click="add">+1</button>
    <button @click="add2">change</button>
  </div>
</template>

<script>
import emitter from '@/mitt';

export default {
  data() {
    return {

    }
  },
  inject: ['name', 'age', 'sex'],
  methods: {
    add() {
      emitter.emit('add')
    },
    add2() {
      emitter.emit('add2', { name: 'kobe', age: 21 })
    }
  }
}
</script>

<style scoped>

</style>